//
//  FBDPictureCollectionViewCell.m
//  iOS9Sample-Photos
//
//  Created by feng on 16/3/7.
//  Copyright © 2016年 小码哥. All rights reserved.
//

#import "FBDPictureCollectionViewCell.h"

@implementation FBDPictureCollectionViewCell
-(instancetype)initWithFrame:(CGRect)frame
{
    self=[super initWithFrame:frame];
    if(self)
    {
        _middeImageView=[[UIImageView alloc] initWithFrame:self.bounds];
//        _middeImageView.frame=CGRectMake(10, 10, CGRectGetWidth(self.bounds)-20, CGRectGetHeight(self.bounds)-20);
        _middeImageView.backgroundColor=[UIColor grayColor];
        _middeImageView.contentMode=UIViewContentModeScaleAspectFill;
        _middeImageView.clipsToBounds=YES;
        _middeImageView.layer.contentsRect=CGRectMake(0, 0, 1, 1);
        [self.contentView addSubview:_middeImageView];
        
        
        
        _statusImageView=[[UIImageView alloc]initWithFrame:CGRectMake(CGRectGetWidth(frame)-20, 2, 20, 20)]
;
        _statusImageView.backgroundColor=[UIColor yellowColor];
        _statusImageView.clipsToBounds=YES;
        _statusImageView.layer.cornerRadius=10;
        [self.contentView addSubview:_statusImageView];
        
    
    }
    
    return self;

}

//利用属性动态改变UI
-(void)setIsSelect:(BOOL)isSelect
{
    _isSelect=isSelect;
    if (_isSelect)
    {
        _statusImageView.backgroundColor=[UIColor redColor];
        
    }else
    {
        _statusImageView.backgroundColor=[UIColor yellowColor];
        
    }
    
    
}

@end
